/****************************************************
          File Name:7-8_v2.cpp
          Author: Abby Cin
          Mail: abbytsing@gmail.com
          Created Time: Sat 20 Dec 2014 02:34:23 PM CST
*****************************************************/

#include<iostream>
using namespace std;

const int Season = 4;

const char *name[Season] = {
    "Spring",
    "Summer",
    "Fall",
    "Winter"
};

struct mem {
    double exp[Season];
};

void fill(double *a)
{
    for(int i = 0; i < Season; i++)
    {
        cout << "Enter " << name[i] << " expenses: ";
        cin >> a[i];
    }
}

void show(const double *a)
{
    double total = 0.0;
    cout << "Expenses" << endl;
    for(int i = 0; i < Season; i++)
    {
        cout << name[i] << ": $" << a[i] << endl;
        total += a[i];
    }

    cout << "Total expenses: " << total << endl;
}

int main()
{
    mem a;
    fill(a.exp);
    show(a.exp);
    return 0;
}
